# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=yaaf
pkgver=7.4d6273a
pkgrel=11
groups=('blackarch' 'blackarch-webapp' 'blackarch-scanner')
pkgdesc='Yet Another Admin Finder.'
arch=('any')
url='https://github.com/RomeuG/YAAF'
license=('GPL')
depends=('python')
makedepends=('git' 'python-setuptools')
source=("$pkgname::git+https://github.com/RomeuG/YAAF.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  # yaaf mixes src layout and flat layout:
  # https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
  # Because sources files are in src/ instead of src/yaaf/ or yaaf/
  # files are deployed under usr/lib/python3.11/site-packages/src/
  # instead of usr/lib/python3.11/site-packages/yaaf/ and conflicts with
  # other packages.
  # Fixing to flat layout here since upstream repository is archived.
  mv src yaaf
  sed -i 's/src.version/yaaf.version/' setup.py
  sed -i 's/src.main/yaaf.main/' setup.py

  python setup.py install --root="$pkgdir" --prefix=/usr
}

